package org.example

import org.apache.spark.sql.{SparkSession, types}
import org.apache.spark.sql.types.{IntegerType, StringType, StructField, StructType}

object yun2 {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession
      .builder()
      .master("local[*]")
      .appName("spark")
      .getOrCreate()
    val sc = spark.sparkContext

    val schemaUser = StructType(Seq(
      StructField("id", IntegerType, nullable = false),
      StructField("gender", StringType),
      StructField("age", IntegerType),
      StructField("occupation", IntegerType),
      StructField("location", StringType)
    ))
    val user =spark.read.option("seq","::").schema(schemaUser)
      .csv("scr/main/resources/users.dat")

    sc.stop()
  }

}
